export default {
    masterBoxsDeal(state,data){
        if(data.list){
            let msg = data.list;
            let tempCommontList = [];
            let tempMasterList = [];
            let masterCommontObj = {};
            let tempMasterObj = {};
            if(Array.isArray(msg) && msg.length > 0){
                msg.forEach((value, index) => {
                    masterCommontObj = {
                        dataInfo:value.dataInfo,
                        hadLiked:value.hadLiked,
                        mediaContents:value.mediaContents,
                        mediaType:value.mediaType,
                        paginationType:2,
                        id:value.id,
                        isNeedContentShare:false,
                        storeId:data.storeId || 0,
                        isNeedLocation:true,
                        isNeedLike:true,
                        isNeedComment:false,
                        isNeedShare:true,
                        isNeedServer:true,
                    };
                    tempMasterObj = {
                        "mediaId":value.id,
                        "mediaType": value.mediaType,
                        "mediaContents": value.mediaContents,
                        "detailPhotos": value.detailPhotos,
                        "poster": value.poster,
                        "bottomSuspension":{
                            type:'master',//大师
                            content:{
                                id:value.id,
                                musicId:value.musicId,
                                classId:value.classId,
                                className:value.className,
                                detailPhotos:value.detailPhotos,
                            }
                        },
                        "belongStoreInfo":{
                            storeId: data.storeId,
                            logo: value.photoUrl,
                            name: value.name,
                            evaluateLevel: "0",//评级
                        },
                    };
                    tempCommontList.push(masterCommontObj);
                    tempMasterList.push(tempMasterObj);
                })
                let masterMsgTempObj = {
                    // headerMsg: 'moudule1',
                    list:tempMasterList,
                }
                state.masterBoxsObj.rtCommont = tempCommontList;
                state.masterBoxsObj.masterMsg = Object.assign({},state.masterBoxsObj.masterMsg,masterMsgTempObj );
                state.masterBoxsObj.show = true;
                state.masterBoxsObj = Object.assign({},state.masterBoxsObj);
                state.marsterClassifyObj = Object.assign({},state.masterBoxsObj);
                console.log(state.masterBoxsObj,'state.masterBoxsObj')
            }
        }else{
            let masterMsgTempObj = {
                // headerMsg: 'moudule1',
                list:[],
            }
            state.marsterClassifyObj.rtCommont = [];
            state.marsterClassifyObj.masterMsg = Object.assign({},state.marsterClassifyObj.masterMsg,masterMsgTempObj );
            state.marsterClassifyObj.show = true;
            state.masterBoxsObj.show = true;
        }
    },
    masterWorksDeal(state,data){
        /* let itemList = [{
                  "itemId": 166,
                  "title": "火花",
                  "priceUnit": "￥",
                  "price": 31.0,
                  "cycleImgs": [                                           //----轮播图
                      "https://oss.pg.yibaotong.top/thumbnails/item/20172_offline/106597348100.png"
                  ],
                  "itemCode": "3125",
                  "quantity": 194,
              }]*/
        let goodsBox = {
            title: "作品集",/*@title goodsBoxs 标题*/
            isNeedScroll: false,//是否需要滚动条
        }
        let tempList = [];
        data.list.forEach((value,index)=>{
            let temp = {
                storeId:data.storeId || 0,
                type:1,//1表示两端布局，价格和卖出商品量,2表示一边是评价一边是日期
                itemId:value.itemId,//商品id
                currency:value.priceUnit || '￥',/*金币的符号*/
                needSmallBall:false,//type 为4 "是否需要小球飞入"
                url:value.cycleImgs[0],/*@url 图片或者视频的url*/
                titleOneLine:false,
                itemTitle:value.title,/*@description 描述*/
                price:value.price,/*@description 价格*/
                buyerNum:value.quantity +"件",/*@buyerNum 已购买件数*/
            }
            tempList.push(temp)
        })
        if(data && data.loadingMore){
            this.state.masterWorksObj.list = {}
        }else{
            let tempObj = {
                list:tempList,
            }
            state.masterWorksObj = Object.assign({},goodsBox,tempObj)
        }
    }
}